<div style="margin:50px 50px 50px 50px">
    <form class="layui-form layui-form-pane" lay-filter="example">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui blue book icon"></i>客户姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="clientName" required lay-verify="required" autocomplete="off"
                           placeholder="请输入客户名" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui blue book icon"></i>客户电话</label>
                <div class="layui-input-block">
                    <input type="text" name="clientContact" required lay-verify="required" autocomplete="off"
                           placeholder="请输入客户电话" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>客户手机</label>
                <div class="layui-input-block">
                    <input type="text" name="clientPhone" required lay-verify="required" autocomplete="off"
                           placeholder="请输入手机" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>客户QQ</label>
                <div class="layui-input-block">
                    <input type="text" name="clientQq" autocomplete="off"
                           placeholder="请输入QQ" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>客户邮箱</label>
                <div class="layui-input-block">
                    <input type="text" name="clientMail" lay-verify="email" autocomplete="off"
                           placeholder="请输入邮箱" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>一级单位</label>
                <div class="layui-input-block">
                    <input type="text" name="firstUnit" autocomplete="off"
                           placeholder="请输入..." class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>三级单位</label>
                <div class="layui-input-block">
                    <input type="text" name="secondUnit" autocomplete="off"
                           placeholder="请输入..." class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>三级单位</label>
                <div class="layui-input-block">
                    <input type="text" name="thirdUnit" autocomplete="off"
                           placeholder="请输入..." class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">

            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-danger">重置</button>
                <!--                <button type="button" class="layui-btn layui-btn-normal" id="LAY-component-form-setval">赋值</button>-->
                <!--                               <button type="button" class="layui-btn layui-btn-normal" id="LAY-component-form-getval">取值</button>-->

            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        const form = layui.form
            , layer = layui.layer;
        form.render('select');
        //监听提交
        form.on('submit(demo1)', function (data) {
            $.ajax({
                url: "/client/add",
                method: "post",
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(data.field),
                dataType: "json",
                success: function () {
                    layer.alert('添加成功', {
                        skin: 'layui-layer-lan' //样式类名
                        , closeBtn: 0
                    });
                }
            })
            return false;
        });
    });
</script>